package cn.wlj.mq.routing;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName RoutingReceiver
 * @Description TODO
 * @Author WLJ
 * @Date 2024/1/23 20:27
 * @Version 1.0
 */
@Configuration
public class RoutingReceiver {
    @RabbitListener(queues = RoutingMqConfig.QUEUE_NAME1)
    public void listener1(String message) {
        System.out.println("队列【" + RoutingMqConfig.QUEUE_NAME1 + "】监听到消息：【" + message + "】");
    }
    @RabbitListener(queues = RoutingMqConfig.QUEUE_NAME2)
    public void listener2(String message) {
        System.out.println("队列【" + RoutingMqConfig.QUEUE_NAME2 + "】监听到消息：【" + message + "】");
    }
    @RabbitListener(queues = RoutingMqConfig.QUEUE_NAME3)
    public void listener3(String message) {
        System.out.println("队列【" + RoutingMqConfig.QUEUE_NAME3 + "】监听到消息：【" + message + "】");
    }

    @RabbitListener(queues = {RoutingMqConfig.QUEUE_NAME2, RoutingMqConfig.QUEUE_NAME3})
    public void listener4(String message) {
        System.out.println("队列【" + RoutingMqConfig.QUEUE_NAME3 + "】、队列【" + RoutingMqConfig.QUEUE_NAME3 + "】监听到消息：【" + message + "】");
    }
}
